import { Room } from '../../api/Room';
import { Card } from '../base/Card';

export class LandGrant extends Card {
	title(room: Room, user: string): string {
		return '职分田';
	}

	desc(room: Room, user: string): string {
		return '自己场上每有1张官员牌获得50铜钱。';
	}

	use(room: Room, user: string, target: string): void {
		var dept = room.getDept(user);
		if (!dept) return;

		var money = 0;
		Object.values(dept.fieldCards).forEach((card) => {
			if (card.tags.includes('官员牌')) money += 50;
		});
		dept.addDeptDataValue('money', money);
	}
}
